import time


class Check(object):
    def __init__(self,func):
        """初始化  接收被装饰的函数引用"""
        self.func = func

    def __call__(self, *args, **kwargs):
        begin = time.time()
        set = self.func(*args, **kwargs)
        end = time.time()
        print(f"运行函数花费的时间是{end - begin}")
        return set

@Check
def func1(name):
    print("%s 运行开始...." %name)
    for i in range(5):
        time.sleep(1)
    print("%s 运行结束....." %name)
func1("牛顿")
